<?php

class SQLJoin extends SQLInstruction {
    const LEFT = 'LEFT ';
    const RIGHT = 'RIGHT ';
    const INNER = 'INNER ';

    private $type;

    public function __construct($type = self::LEFT) {
        $this->type = $type;
    }

    public function getInstruction() {
        if (isset($this->criteria)) {
            return $this->type . 'JOIN ' . $this->entity . ' ' . $this->alias . ' ON ' . $this->criteria->dump();
        }
        return null;
    }

}
